﻿namespace LogManager.Utils.Unity.Rules
{
    using NUnit.Framework;
    using System;
    using System.ComponentModel;

    public class TestImplementsINotifyPropertyChanged
    {
        [Test]
        public void ImplementsINotifyPropertyChanged_Matches_ClassImplementingINotifyPropertyChanged_DoesMatch()
        {
            var inst = new ImplementsINotifyPropertyChanged();
            Assert.IsTrue(inst.Matches(null, typeof(IDoImplementPropertyChanged)));
        }

        [Test]
        public void ImplementsINotifyPropertyChanged_Matches_ClassNotImplementingINotifyPropertyChanged_DoesNotMatch()
        {
            var inst = new ImplementsINotifyPropertyChanged();
            Assert.IsFalse(inst.Matches(null, typeof(IDoNotImplementPropertyChanged)));
        }

        public class IDoImplementPropertyChanged : INotifyPropertyChanged
        {
            event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
            {
                add { throw new NotImplementedException(); }
                remove { throw new NotImplementedException(); }
            }
        }

        public class IDoNotImplementPropertyChanged 
        {
        }
    }
}
